﻿using Autofac.Extensions.DependencyInjection;
using Common.IOC;
using Microsoft.AspNetCore.Builder;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Host.Extensions
{
    /// <summary>
    /// 依赖注入扩展
    /// </summary>
    public static class DependencyInjectionExtension
    {
        /// <summary>
        /// 使用Autofac容器管理
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseAutofacManager(this IApplicationBuilder app)
        {
            AutofacContainer.Container = app.ApplicationServices.GetAutofacRoot();
            return app;
        }
    }
}
